<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class AddAuditorAndAuditTimeToDriversTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        if (!Schema::hasColumns('drivers', ['audit_time', 'auditor_id'])) {
            Schema::table('drivers', function (Blueprint $table) {
                $table->bigInteger('auditor_id')->nullable()->comment('审核人ID');
                $table->timestamp('audit_time')->nullable()->comment('审核时间');
            });
        }
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        if (Schema::hasColumns('drivers', ['auditor_id', 'audit_time'])) {
            Schema::table('drivers', function (Blueprint $table) {
                $table->dropColumn(['auditor_id', 'audit_time']);
            });
        }
    }
}
